package com.jinxin.platform.cdysylives.rpc;

import com.alibaba.fastjson.JSONObject;
import com.jinxin.platform.base.api.annotation.*;
import com.jinxin.platform.base.api.constant.APCOSApiConstans;
import com.jinxin.platform.base.common.annotation.RegBusiness;
import com.jinxin.platform.base.common.pojo.JsonResult;
import com.jinxin.platform.cdysylives.common.Constant;
import com.jinxin.platform.cdysylives.mapper.CdysylivesMonitorDeviceMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author 那个男人
 * @Date 2023/12/13 16:19
 * @Version 1.0
 */
@RegBusiness(moduleKey = Constant.MODULE_KEY, className = Constant.MODULE_CLASS_NAME)
@Service
@Slf4j
public class CdysyliveSupportRpc {

    @Autowired
    private CdysylivesMonitorDeviceMapper monitorDeviceMapper;

    @APCOSApiOperation(value = "统计设备数量",description = "统计设备数量",infDict = "统计设备数量",
            reqDemo = "{}",
            respDemo = "{\"total\":20}",
            infType = APCOSApiConstans.INF_TYPE_OTHER,developers = {"那个男人"})
    @APCOSApiRequests({
    })
    @APCOSApiResponses({
            @APCOSApiResponse(name = "total", value = "设备数量", dict = "设备数量",fieldType = APCOSApiConstans.FIELD_TYPE_GN,
                    dataType = APCOSApiConstans.DATA_TYPE_STR, lenth = "8",remark = "设备数量"),
    })
    public JsonResult queryDeviceCount(Map param){
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("total",monitorDeviceMapper.listPageCount(new HashMap()));
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("data",resultMap);
        return JsonResult.ok("success",jsonObject);
    }
}
